﻿@using Apps.Web.Core;
@using Apps.Web;
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Locale;
@using Apps.Web.Core;
@using Apps.Web;
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Locale;
@using Wantn.FIS.Enum
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index_Layout.cshtml";
    List<permModel> perm = null;
    //焦炭反应性数据查询
}

<div id="uploadExcel" class="easyui-window" data-options="modal:true,closed:true,minimizable:false,shadow:false">
    <form name="form1" method="post" id="form1">
        <table>
            <tr>
                <th style="padding:20px; "> Excel：</th>
                <td style="padding:20px; ">
                    <input name="ExcelPath" type="text" maxlength="255" id="txtExcelPath" readonly="readonly" style="width:200px" class="txtInput normal left">
                    <a href="javascript:$('#FileUpload').trigger('click').void(0);" class="files">@Resource.Browse</a>
                    <input class="displaynone" type="file" id="FileUpload" name="FileUpload" onchange="Upload('ExcelFile', 'txtExcelPath', 'FileUpload'); ">
                    <span class="uploading">@Resource.Uploading</span>
                </td>
            </tr>
        </table>
        <div class="endbtndiv">
            <a id="btnSave" href="javascript:ImportData()" class="easyui-linkbutton btns">直接保存</a>
            <a id="btnReturn" href="javascript:$('#uploadExcel').window('close')" class="easyui-linkbutton btnc">@Resource.Cancel</a>
        </div>
    </form>
</div>
<div class="mvctool">
    @*<input id="txtTestCode" type="text" class="searchText" placeholder="化验编码" />*@
    @*@Html.DropDownList("queryState", EnumMvcHelper.GetMVCSelectList<ApprovalStatus>("审批状态"), new { @style = "width:100px;" })*@

    <input id="txtTestCode" type="text" class="searchText" placeholder="化验编码" />
    <select class="easyui-combobox" name="Instrument" id="Instrument" style="width:120px;">
        <option value="">=== 全部设备 ===</option>
        <option value="56">焦炭反应性1#</option>
        <option value="57">焦炭反应性2#</option>
        <option value="58">焦炭反应性3#</option>
        <option value="59">焦炭反应性4#</option>
        <option value="60">焦炭反应性5#</option>
        <option value="61">焦炭反应性6#</option>
        <option value="62">焦炭反应性7#</option>
    </select>
    <input id="txtStartDate" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'txtEndDate\')}' })" class="condition-date" type="text" placeholder="化验日期起" />
    <input id="txtEndDate" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'txtStartDate\')}' })" class="condition-date" type="text" placeholder="化验日期止" />
    @Html.ToolButton("btnQuery", "fa fa-search", Resource.Query, ref perm, "Query", true)
    @Html.ToolButton("btnExprot", "fa fa-download", Resource.Export, ref perm, "Export", true)
</div>
<table id="List"></table>
@Html.Partial("~/Views/Shared/_Partial_AutoGrid.cshtml")
<div id="modalwindow" class="easyui-window" style="width:800px; height:400px;" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div>
<script type="text/javascript">
    $(function () {
        $('#List').datagrid({
            url: '@Url.Action("GetList")',
            width: SetGridWidthSub(10),
            methord: 'post',
            height: SetGridHeightSub(45),
            fitColumns: true,
            sortName: 'ADDTIME',
            sortOrder: 'desc',
            idField: 'ID',
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true, //奇偶行是否区分
            singleSelect: true,//单选模式
            selectOnCheck: false,
            checkOnSelect: false,
            checkbox: true,
            rownumbers: true,//行号
            onLoadSuccess: function (data) {
                $("#List").datagrid("clearSelections"); //全部不选中
                $("#List").datagrid("clearChecked"); //全部不选中
                $("#List").datagrid("unselectAll"); //全部不选中
            },
            columns: [[
                { field: 'INSTRUMENT', title: '设备编号', width: '120px' },
                { field: 'TEST_CODE', title: '化验码', width: '100px' },
                { field: 'AUTO_NO', title: '自动编号', width: 140, sortable: true },
                { field: 'SAMPLE_WEIGHT', title: '试样质量(g)', width: 140 },
                { field: 'SAMPLE_COUNT', title: '试样粒数', width: 140 },
                { field: 'CRI_WEIGHT', title: '反应后残余质量(g)', width: 140 },
                { field: 'CRI_COUNT', title: '反应后残余粒数', width: 140 },
                { field: 'CSR_WEIGHT', title: '转鼓后大于10mm粒数级质量(g)', width: 200 },
                { field: 'CSR_COUNT', title: '转鼓后大于10mm粒数级粒数', width: 200 },
                { field: 'CRI', title: 'CRI%', width: 80 },
                { field: 'CSR', title: 'CSR%', width: 80 },
                { field: 'TEST_TIME', title: '化验时间', width: 140 },
                { field: 'TEST_USER', title: '化验员', width: 80 },
                { field: 'REMARK', title: '备注', width: 80 },
            ]], onClickRow: function (index, row) {
            }

        });
    });


    //ifram 返回
    function frameReturnByClose() {
        $("#modalwindow").window('close');
    }

    function frameReturnByReload(flag) {
        if (flag)
            $("#List").datagrid('load');
        else
            $("#List").datagrid('reload');

        $("#List").datagrid("clearSelections"); //全部不选中
        $("#List").datagrid("clearChecked"); //全部不选中
        $("#List").datagrid("unselectAll"); //全部不选中
    }
    function frameReturnByMes(mes) {
        $.messageBox5s(Lang.Tip, mes);
    }
    function GetData() {
        $("#List").datagrid("load", {
            TestCode: $("#txtTestCode").val(),
            startdate: $("#txtStartDate").val(),
            enddate: $("#txtEndDate").val(),
            Instrument: $("#Instrument").combobox('getValues').toString(),
        });
    }
    $(function () {
        $("#btnQuery").click(function () {
            GetData();
        });
        $("#btnExprot").click(function () {
            let startdate = $("#txtStartDate").val();
            let enddate = $("#txtEndDate").val();
            if (startdate == '' || startdate == undefined) {
                $.messageBox5s(Lang.Tip, '请选择实验开始时间');
                return;
            }
            if (enddate == '' || enddate == undefined) {
                $.messageBox5s(Lang.Tip, '请选择实验结束时间');
                return;
            }
            GetData();
            var url = '@Url.Action("Export")' + '?TestCode=' + $("#txtTestCode").val() + '&startdate=' + $("#txtStartDate").val() + '&enddate=' + $("#txtEndDate").val() + '&Instrument=' + $("#Instrument").combobox('getValues').toString();
            window.open(url);
         });
    });
</script>

